// routes/categoryRoutes.js
const express = require('express');
const router = express.Router();
const {
  createCategory,
  getAllCategories,
  updateCategory,
  deleteCategory,
} = require('../controllers/categoryController');
const { protect } = require('../middleware/authMiddleware');

router.route('/')
  .post(protect, createCategory) // 创建需要登录
  .get(getAllCategories);       // 查看是公开的

router.route('/:id')
  .put(protect, updateCategory)   // 更新需要登录
  .delete(protect, deleteCategory); // 删除需要登录

module.exports = router;